//封装一个AuthRoute路由高阶鉴权组件，

import { getToken } from '@/utils/token'
import { Navigate } from 'react-router-dom'

// 实现未登录拦截，并跳转到登陆页面
const AuthRoute=({children})=>{
    const token=getToken()
    if(token){
        return <>{children}</>
    }else{
        return <Navigate to="/login" replace/>
    }
}

export default AuthRoute